import smtplib
from email.mime.text import MIMEText
from email.header import Header
from email.mime.multipart import MIMEMultipart
from email.mime.application import MIMEApplication
import os
import numpy as np
import pandas as pd


PATH = 'Z:\\autoEmail\\'
SENDER = 'dfcw@orientsec.com.cn'
PASSWORD = 'Ddcw2010'
sourcePrex = {'mao': '汇总', 'capital':'成本法汇总','system': '场外期权合约表_', 'AXZQ': '安信估值_东方证券股份有限公司', 'ZTZQ': '东方证券场外期权估值表', 'swap-index': '指数互换','swap': '互换'}

def getSendEmailStr(df,text=''):
    colnames = df.columns
    data = df.values
    dataStr = ""
    dataStr += '''
               <p>您好:</p>
               <p>下文是估值报表, 请查收。</p>
               <p></p>
               <table border="1" cellpadding="0" cellspacing="0" width="1800" style="border-collapse: collapse;">
               <tbody>
                <tr>
               '''

    for col in colnames:
        dataStr += '''
                   <th>{0}</th>
                   '''.format(col)

    dataStr += '''
                </tr>
               '''
    for i in range(data.shape[0]):
        dataStr += '''
                    <tr>
                   '''
        pass
        for j in range(data.shape[1]):
            dataStr += '''
                        <td  style="text-align:center"> {0} </td>
                       '''.format(data[i][j])
            pass
        dataStr += '''
                    </tr>
                   '''
    if text != '':
        dataStr += '''
                    </tbody>
                    </table>
                    <p>{0}</p>
                    <p></p>
                    <p></p>
                    <p>以下免责声明，请您务必仔细阅读：</p>
                    <p>东方证券提供的衍生品合约价值报告仅供参考，请贵方审慎核对该报告后使用，如有疑问请及时沟通、反馈。东方证券不对贵方使用合约价值报告产生的结果承担责任；合约价值报告因政策法规变化、自然灾害、系统故障、行情传输错误等不可抗力出现延迟、中断、错误等，东方证券不承担责任。</p>
                    <p>东方证券提供的衍生品合约价值报告不应作为任何资产管理产品进行任何份额或权益变更的依据；若任何资产管理产品基于该合约价值报告等信息进行开放申购、赎回等份额或权益变更操作，东方证券不对该等操作的公允性和法律适当性承担任何责任。</p>
                    <p>东方证券提供的衍生品合约价值报告基于东方证券内部模型计算得出，该内部模型的调整、优化由东方证券自行决定。</p>
                    <p>东方证券提供的衍生品合约价值报告仅提供给贵方作查照，非出于本邮件实现之目的的转发无效，贵方不可随意泄露给除外包机构、托管机构或投资顾问以外等无关的第三方。</p>
                    <p></p>
                    <p></p>
                    <p>注：本邮件为自动发送，如有任何问题，请联系xgxg@orientsec.com.cn，我们将在收到邮件后3个工作日内处理。</p>
                    '''.format(text)
    else:
        dataStr += '''
                    </tbody>
                    </table>
                    <p></p>
                    <p>以下免责声明，请您务必仔细阅读：</p>
                    <p>东方证券提供的衍生品合约价值报告仅供参考，请贵方审慎核对该报告后使用，如有疑问请及时沟通、反馈。东方证券不对贵方使用合约价值报告产生的结果承担责任；合约价值报告因政策法规变化、自然灾害、系统故障、行情传输错误等不可抗力出现延迟、中断、错误等，东方证券不承担责任。</p>
                    <p>东方证券提供的衍生品合约价值报告不应作为任何资产管理产品进行任何份额或权益变更的依据；若任何资产管理产品基于该合约价值报告等信息进行开放申购、赎回等份额或权益变更操作，东方证券不对该等操作的公允性和法律适当性承担任何责任。</p>
                    <p>东方证券提供的衍生品合约价值报告基于东方证券内部模型计算得出，该内部模型的调整、优化由东方证券自行决定。</p>
                    <p>东方证券提供的衍生品合约价值报告仅提供给贵方作查照，非出于本邮件实现之目的的转发无效，贵方不可随意泄露给除外包机构、托管机构或投资顾问以外等无关的第三方。</p>
                    <p></p>
                    <p></p>
                    <p>注：本邮件为自动发送，如有任何问题，请联系xgxg@orientsec.com.cn，我们将在收到邮件后3个工作日内处理。</p>
                    '''
    return dataStr
    pass

def sendMail(myDict):
    date = myDict['date']
    result = myDict['result']
    try:
        text=myDict['text']
    except:
        text=''
    if list(result.values) == []:
        constract = myDict['idList']
        print(f'合约{constract}对应的邮件内容缺失，请检查后重试！')
    else:
        dataStr = getSendEmailStr(result,text)
        subject = myDict['subject']
        targetEmail = myDict['targetEmail']
        ACCEPTER = ''
        for item in targetEmail:
            ACCEPTER += item + ','
        ACCEPTER = ACCEPTER[:-1]

        excelFile = PATH + str(date) + '\\' + subject + str(date) + '.xlsx'
        # df['label'] = round(df['label'], 2)
        mail_msg = dataStr
        EMS = MIMEMultipart()
        textApart = MIMEText(mail_msg, 'html', 'utf-8')
        excelApart = MIMEApplication(open(excelFile, 'rb').read())
        excelApart.add_header('Content-Disposition', 'attachment', filename=subject + str(date) + '.xlsx')
        EMS.attach(textApart)
        EMS.attach(excelApart)
        # 设置发件人信息
        EMS['From'] = Header(SENDER)
        # 设置收件人信息
        EMS['To'] = Header(ACCEPTER)
        # 设置邮件主题
        EMS['Subject'] = Header(subject, 'utf-8')

        try:
            smtpObj = smtplib.SMTP('smg.orientsec.com.cn')
            smtpObj.login(SENDER, PASSWORD)
            smtpObj.sendmail(SENDER, targetEmail, EMS.as_string())
            print("邮件发送成功")
        except smtplib.SMTPException:
            print("Error: 无法发送邮件")
        pass

def GetData(date, acceptDict):
    # 提取acceptDict参数
    idList = acceptDict['idList']
    sendtype = acceptDict['sendtype']
    date = str(date)
    files = os.listdir(PATH)
    if files == []:
        print('路径文件夹读取为空，请检查文件夹路径是否错误！')

    try:
        sourceFileName = os.path.join(PATH, sourcePrex['mao'] + str(date) + '.xlsx')
        maodf = pd.read_excel(sourceFileName)
        maodf = maodf[maodf['产品代码'].isin(idList)]
        maodf = maodf[maodf['估值日期'] == date[:4] + '/' + date[4:6] + '/' + date[6:]]
        maodf.sort_values(by="产品代码", ascending=False)
    except:
        print(f'文件{sourceFileName}不在路径文件夹中，请检查文件是否存放正确！')
    try:
        sourceFileName = os.path.join(PATH, sourcePrex['capital'] + str(date) + '.xlsx')
        capdf = pd.read_excel(sourceFileName)
        capdf = capdf[capdf['产品代码'].isin(idList)]
        capdf = capdf[capdf['估值日期'] == date[:4] + '/' + date[4:6] + '/' + date[6:]]
        capdf.sort_values(by="产品代码", ascending=False)
    except:
        print(f'文件{sourceFileName}不在路径文件夹中，请检查文件是否存放正确！')
    try:
        sourceFileName = os.path.join(PATH,sourcePrex['system'] + str(date)[0:4] + '-' + str(date)[4:6] + '-' + str(date)[6:8] + '.xlsx')
        sysdf = pd.read_excel(sourceFileName, engine='xlrd')
        label_position = sysdf[sysdf.日期 == '日期'].index.tolist()
        sysdf = pd.read_excel(sourceFileName, skiprows=label_position[0] + 1, engine='xlrd')
        sysdf = sysdf[sysdf['确认书编号（双方约定）'].isin(idList)]
        sysdf.sort_values(by="确认书编号（双方约定）", ascending=False)
        sysdf = sysdf[sysdf['存续'] == '是']
    except:
        print(f'文件{sourceFileName}不在路径文件夹中，请检查文件是否存放正确！')
    try:
        sourceFileName = os.path.join(PATH,sourcePrex['AXZQ'] + str(date)[0:4] + '-' + str(date)[4:6] + '-' + str(date)[6:8] + '.xls')

        axzqdf = pd.read_excel(sourceFileName)
        axzqdf = axzqdf[axzqdf['交易确认书编号'].isin(idList)]
    except:
        print(f'文件{sourceFileName}不在路径文件夹中，请检查文件是否存放正确！')
    try:
        sourceFileName = os.path.join(PATH, sourcePrex['ZTZQ'] + str(date) + '.xlsx')
        ztzqdf = pd.read_excel(sourceFileName)
        ztzqdf = ztzqdf[ztzqdf['合约编号'].isin(idList)]
        ztzqdf.sort_values(by="合约编号", ascending=False)
    except:
        print(f'文件{sourceFileName}不在路径文件夹中，请检查文件是否存放正确！')
    try:
        sourceFileName = os.path.join(PATH, sourcePrex['swap-index'] + str(date) + '.xlsx')
        spdf = pd.read_excel(sourceFileName)
        label_position = spdf[spdf.产品标的 == '交易确认书编号'].index.tolist()
        spdf = pd.read_excel(sourceFileName, skiprows=label_position[0] + 1)
        spdf = spdf[spdf['交易确认书编号'].isin(idList)]
    except:
        print(f'文件{sourceFileName}不在路径文件夹中，请检查文件是否存放正确！')
    try:
        sourceFileName = os.path.join(PATH, sourcePrex['swap'] + str(date) + '.xlsx')
        swapdf = pd.read_excel(sourceFileName)
        swapdf = swapdf[swapdf['合约编号'].isin(idList)]
    except:
        print(f'文件{sourceFileName}不在路径文件夹中，请检查文件是否存放正确！')


    result = pd.DataFrame()

    if sendtype == "snowballnotes":
        maodf.rename(columns={'收益凭证名称': '产品名称'}, inplace=True)
        maodf['净值'] = maodf['总估值'] / maodf['投资金额']
        maodf['净值'] = round(maodf['净值'], 4)
        maodf['投资金额'] = round(maodf['投资金额'], 2)
        maodf['浮动损益'] = round(maodf['浮动损益'], 2)
        maodf['总估值'] = round(maodf['总估值'], 4)
        result = maodf
        # dataStr=getSendEmailStr(maodf)
    elif sendtype == "snowballoptions-JSZB":
        maodf.rename(columns={'收益凭证名称': '产品名称', '产品代码': '交易确认书编号', '投资金额': '名义本金', '总估值': '产品估值', }, inplace=True)
        maodf['券商名称'] = '东方证券股份有限公司'
        # maodf['标的']=list(sysdf['标的证券'])
        maodf = maodf[['交易确认书编号', '产品名称', '产品估值', '估值日期']]
        # maodf['名义本金']=round(maodf['名义本金'],2)
        maodf['产品估值'] = round(maodf['产品估值'], 2)
        result = maodf
        # dataStr=getSendEmailStr(maodf)
    elif sendtype == "snowballoptions":
        maodf.rename(columns={'收益凭证名称': '买方（产品名称）', '产品代码': '交易/合约编号', '投资金额': '名义本金', '总估值': '当日市值', }, inplace=True)
        maodf['券商名称'] = '东方证券'
        #  maodf['标的']=list(sysdf['标的证券'])
        maodf = maodf[['券商名称', '买方（产品名称）', '交易/合约编号', '估值日期', '名义本金', '当日市值']]
        maodf['名义本金'] = round(maodf['名义本金'], 2)
        maodf['当日市值'] = round(maodf['当日市值'], 2)
        result = maodf
        # dataStr=getSendEmailStr(maodf)
    elif sendtype == "snowballoptions-BRYT":
        maodf.rename(columns={'收益凭证名称': '买方（产品名称）', '产品代码': '交易/合约编号', '投资金额': '名义本金', '浮动损益': '合约盈亏', '总估值': '净估值', },
                     inplace=True)
        maodf['券商名称'] = '东方证券'
        # maodf['标的']=list(sysdf['标的证券'])
        maodf = maodf[['券商名称', '买方（产品名称）', '交易/合约编号', '估值日期', '名义本金', '合约盈亏', '净估值']]
        maodf['名义本金'] = round(maodf['名义本金'], 2)
        maodf['净估值'] = round(maodf['净估值'], 2)
        maodf['期权费'] = 0
        maodf['资金余额'] = round(maodf['名义本金'] * 0.987, 2)
        result = maodf
        # dataStr=getSendEmailStr(maodf)
    elif sendtype == "snowballoptions-SHZQ":
        marginList = acceptDict['marginList']
        capdf.rename(columns={'收益凭证名称': '买方（产品名称）', '产品代码': '交易/合约编号', '投资金额': '名义本金', '浮动损益': '合约盈亏'}, inplace=True)
        capdf['券商名称'] = '东方证券'
        # maodf['标的']=list(sysdf['标的证券'])
        capdf = capdf[['券商名称', '买方（产品名称）', '交易/合约编号', '名义本金', '合约盈亏', '估值日期']]
        capdf['名义本金'] = round(capdf['名义本金'], 2)
        capdf['合约盈亏'] = round(capdf['合约盈亏'], 2)
        capdf['保证金'] = round(capdf['名义本金'] * marginList, 2)
        result = capdf
    elif sendtype == "snowballoptions-margin":
        marginList = acceptDict['marginList']
        maodf.rename(columns={'收益凭证名称': '买方（产品名称）', '产品代码': '交易/合约编号', '投资金额': '名义本金', '浮动损益': '合约盈亏'}, inplace=True)
        maodf['券商名称'] = '东方证券'
        # maodf['标的']=list(sysdf['标的证券'])
        maodf = maodf[['券商名称', '买方（产品名称）', '交易/合约编号', '名义本金', '合约盈亏', '估值日期']]
        maodf['名义本金'] = round(maodf['名义本金'], 2)
        maodf['合约盈亏'] = round(maodf['合约盈亏'], 2)
        maodf['保证金'] = round(maodf['名义本金'] * marginList, 2)
        result = maodf
    elif sendtype == "snowballoptions-SNHY":
        maodf.rename(columns={'收益凭证名称': '买方（产品名称）', '产品代码': '交易/合约编号', '投资金额': '名义本金', '浮动损益': '合约盈亏'}, inplace=True)
        maodf['券商名称'] = '东方证券'
        # maodf['标的']=list(sysdf['标的证券'])
        maodf = maodf[['券商名称', '买方（产品名称）', '交易/合约编号', '名义本金', '合约盈亏', '估值日期']]
        maodf['名义本金'] = round(maodf['名义本金'], 2)
        maodf['合约盈亏'] = round(maodf['合约盈亏'], 2)
        maodf['保证金'] = round(maodf['名义本金'] * 0.99, 2)
        maodf['总估值'] = round(maodf['名义本金'] + maodf['合约盈亏'], 2)
        result = maodf
    elif sendtype == "auoptions":
        sysdf['财务估值数据'] = -sysdf['财务估值数据']
        sysdf.rename(
            columns={'确认书编号（双方约定）': '产品簿记编号', '日期': '估值日期', '成立日': '交易起始日', '到期日': '交易到期日', '名义本金': '合约名义本金额(计价货币)',
                     '财务估值数据': '产品估值（人民币）', '标的证券': '标的代码'}, inplace=True)
        sysdf['计价货币'] = 'CNY'
        sysdf['单位成本（计价货币）'] = 'CNY'
        sysdf['单位净值（计价货币）'] = 'CNY'
        sysdf['产品成本（计价货币）'] = 'CNY'
        sysdf['参考汇率'] = 1
        sysdf['期权收益估值'] = sysdf['产品估值（人民币）']
        sysdf['产品估值（人民币）'] = round(sysdf['产品估值（人民币）'], 2)
        sysdf['期权收益估值'] = round(sysdf['期权收益估值'], 2)
        sysdf['合约名义本金额(计价货币)'] = round(sysdf['合约名义本金额(计价货币)'], 2)
        sysdf = sysdf[['产品簿记编号', '估值日期', '交易起始日', '交易到期日', '合约名义本金额(计价货币)', '计价货币', '标的代码', '单位成本（计价货币）', '单位净值（计价货币）',
                       '产品成本（计价货币）', '产品估值（人民币）', '参考汇率', '期权费', '期权收益估值']]
        result = sysdf
        # dataStr=getSendEmailStr(sysdf)
    elif sendtype == "otheroptions":
        sysdf = sysdf[['日期', '对手方', '确认书编号（双方约定）', '标的证券', '资产市值']]
        sysdf.rename(columns={'确认书编号（双方约定）': '交易确认书编号', '日期': '估值日期', '资产市值': '产品估值', '对手方': '交易对手方', '标的证券': '标的代码'},
                     inplace=True)
        sysdf['产品估值'] = round(sysdf['产品估值'], 2)
        result = sysdf
        # dataStr=getSendEmailStr(sysdf)
        pass
    elif sendtype == "otheroptions-GFZG":
        sysdf = sysdf[['日期', '对手方', '确认书编号（双方约定）', '标的证券', '资产市值', '期权费']]
        sysdf.rename(columns={'确认书编号（双方约定）': '交易确认书编号', '日期': '估值日期', '资产市值': '产品估值', '对手方': '交易对手方', '标的证券': '标的代码',
                              '期权费': '期权费'}, inplace=True)
        sysdf['产品估值'] = round(sysdf['产品估值'], 2)
        sysdf['期权费'] = round(sysdf['期权费'], 2)
        sysdf['合约估增'] = round(sysdf['产品估值'] - sysdf['期权费'], 2)
        result = sysdf
        # dataStr=getSendEmailStr(sysdf)
        pass
    elif sendtype == "otheroptions-JSZB":
        sysdf = sysdf[['日期', '对手方', '确认书编号（双方约定）', '标的证券', '资产市值']]
        sysdf.rename(columns={'确认书编号（双方约定）': '交易确认书编号', '日期': '估值日期', '资产市值': '产品估值', '对手方': '产品名称', '标的证券': '标的代码'},
                     inplace=True)
        sysdf['产品估值'] = round(sysdf['产品估值'], 2)
        sysdf = sysdf[['交易确认书编号', '产品名称', '产品估值', '估值日期']]
        result = sysdf
        # dataStr=getSendEmailStr(sysdf)
        pass
    elif sendtype == "axzq":
        mydf = []
        for i in range(len(idList)):
            id = idList[i]
            axzq0 = axzqdf[axzqdf['交易确认书编号'] == id]
            if axzq0.shape[0] == 0:
                continue
            mydf.append({'交易确认书编号': acceptDict['transferIdList'][i], '交易对手名称': '东方证券股份有限公司',
                         '起息日/期初观察日': axzq0['起息日/期初观察日'].iloc[0],
                         '期权估值(T)': axzq0['期权估值(T)'].iloc[0] + acceptDict['pvModify'][i]})
        mydf = pd.DataFrame(mydf)
        result = mydf
        # dataStr=getSendEmailStr(mydf)
        pass
    elif sendtype == "ztzq":
        mydf = []
        for i in range(len(idList)):
            id = idList[i]
            ztzq0 = ztzqdf[ztzqdf['合约编号'] == id]
            if ztzq0.shape[0] == 0:
                continue
            mydf.append(
                {'合约编号': acceptDict['transferIdList'][i], '期权价值': ztzq0['期权价值'].iloc[0] + acceptDict['pvModify'][i]})
        mydf = pd.DataFrame(mydf)
        mydf['估值日期'] = list(ztzqdf['估值日期'])
        mydf['名义本金'] = list(ztzqdf['名义本金'])
        mydf['起始日'] = list(ztzqdf['起始日'])
        mydf['到期日'] = list(ztzqdf['到期日'])
        mydf['标的代码'] = list(ztzqdf['标的代码'])
        mydf['期权类型'] = list(ztzqdf['期权类型'])
        mydf['交易方向'] = list(ztzqdf['交易方向'])
        mydf['期权费'] = list(ztzqdf['期权费'])
        mydf['期权损益'] = list(ztzqdf['期权损益'])
        mydf['交易主体'] = list(ztzqdf['交易主体'])
        mydf['客户cashDelta'] = list(ztzqdf['客户cashDelta'])
        result = mydf
        # dataStr=getSendEmailStr(mydf)
        pass
    elif sendtype == "swap-index":
        spdf.rename(columns={'互换': '产品名称', '市值': '产品估值'}, inplace=True)
        spdf['估值日期'] = date[:4] + '/' + date[4:6] + '/' + date[6:]
        spdf = spdf[['交易确认书编号', '产品名称', '产品估值', '估值日期']]
        result = spdf
        # dataStr=getSendEmailStr(maodf)
    elif sendtype == "swap":
        swapdf = swapdf[~(swapdf['结构'] == '明细')]
        swapdf.rename(columns={'合约编号': '交易/合约编号', '互换': '产品名称', '到期': '合约盈亏', '保证金': 'NAN', '存续保证金': '保证金'},
                      inplace=True)
        # swapdf['产品估值']=round(swapdf['产品估值'].astype('float'),2)
        swapdf['券商名称'] = '东方证券'
        swapdf['名义本金'] = round(swapdf['存续名义本金'].astype('float'), 2)
        swapdf['估值日期'] = date[:4] + '/' + date[4:6] + '/' + date[6:]
        swapdf = swapdf[['券商名称', '产品名称', '交易/合约编号', '标的', '名义本金', '合约盈亏', '估值日期', '保证金']]
        result = swapdf
    elif sendtype == "swap-detail":
        swapdf.rename(columns={'折合': '折合份数', '到期': '合约盈亏'}, inplace=True)
        #  swapdf=swapdf.astype('string')
        swapdf = swapdf[
            ['合约编号', '互换', '结构', '标的', '初始名义本金', '存续名义本金', '折合份数', '初始保证金', '存续保证金', '标的现价', '成立日', '到期日', '单价', '市值',
             '是否存续', '成立日点位', '计息天数', '分红金额', '未实现浮动收益', '已实现浮动收益', '浮动收益', '未实现固定收益', '已实现固定收益', '固定收益', '交易佣金',
             '合约盈亏']]
        result = swapdf
        # dataStr=getSendEmailStr(maodf)
    elif sendtype == "gf-swap":
        for i in range(len(spdf.columns)):
            spdf.iloc[:, i] = spdf.iloc[:, i].astype('string').str.replace('\xa0', '')
            spdf.iloc[:, i] = spdf.iloc[:, i].astype('string').str.replace(',', '')
        spdf.rename(columns={'互换': '产品名称', '市值': '产品估值', '名义本金': '名义本金', '期权费/预付金': '保证金'}, inplace=True)
        spdf['名义本金'] = round(10000 * spdf['名义本金'].astype('float'), 2)
        spdf['保证金'] = round(spdf['保证金'].astype('float'), 2)
        spdf['产品估值'] = round(spdf['产品估值'].astype('float'), 2)
        spdf['合约估增'] = round(spdf['产品估值'] - spdf['保证金'], 2)
        spdf['估值日期'] = date[:4] + '/' + date[4:6] + '/' + date[6:]
        spdf = spdf[['交易确认书编号', '产品名称', '名义本金', '保证金', '产品估值', '合约估增', '估值日期']]
        result = spdf
        # dataStr=getSendEmailStr(maodf)

    OUTPUTPATH = PATH + str(date) + '\\'
    # 判断路径是否存在
    # 存在     True
    # 不存在   False
    isExists = os.path.exists(OUTPUTPATH)
    # 判断结果P
    if not isExists:
        # 如果不存在则创建目录
        # 创建目录操作函数
        os.makedirs(OUTPUTPATH)
    excelFile = OUTPUTPATH + acceptDict['subject'] + str(date) + '.xlsx'
    result.to_excel(excelFile, encoding='utf-8', index=False, header=True)
    acceptDict['result'] = result
    return (acceptDict)

def ToAddress(Agents, Self, config=False):
    acceptDictList = []
    if config == True:
        acceptDictList = Agents
    else:
        acceptDictList = Self
    return acceptDictList
########################################################################################################
if __name__ == '__main__':
    dateList = ['20220805']
    acceptDictList_Self = [
########################################################################################################
                         # 每天发送
                   #    {"idList": ['HQCZ-O20220223001','HQCZ-O20220223002','HQCZ-O20220301001'], 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'snowballoptions-margin','marginList':[0.2,0.2,0.2],'subject':'横琴淳臻投资管理中心（有限合伙）代淳臻灵活配置3期私募证券投资基金场外期权估值'},
                   #    {"idList": ['ABM-O20220315001'], 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'snowballoptions-margin','marginList':[0.2],'subject':'珠海阿巴马代创新驱动3号场外期权估值(雪球期权)'},
                   #     {"idList": ['YSTZ-O20220422001'], 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'snowballoptions-margin','marginList':[1],'subject':'迎水绿洲12号场外期权估值(雪球期权)'},
                   #     {"idList": ['SNTZ-O20220525001','SNTZ-O20220615001','SNTZ-O20220615002'], 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'snowballoptions-SNHY','subject':'东方证券-寿宁海韵26号场外期权估值(雪球期权)'},
                   #   {"idList": ['YSTZ-O20220617004','YSTZ-O20220617001','YSTZ-O20220617002','YSTZ-O20220617003','YSTZ-O20220728001'], 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'snowballoptions-margin','marginList':[1,1,1,1,1],'subject':'东方证券-迎水投资聚宝20号场外期权估值(雪球期权)'},
                   #   {"idList": ['FZZQ-O20220623001'], 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'otheroptions','subject':'东方证券-方正证券艾华5号场外期权估值'},
                   #  {"idList": ['JXTZ-O20220628801'], 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'snowballoptions-margin','marginList':[0.2],'subject':'东方证券-深圳金犀基金场外期权估值(雪球期权)'},
                   #   {"idList": ['YHDR-O20220704801'], 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'snowballoptions-margin','marginList':[0.2],'subject':'东方证券-银河德睿场外期权估值(雪球期权)'},
                   #   {"idList": ['PSTZ-O20220705801', 'PSTZ-O20220712801', 'PSTZ-O20220719801'], 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'snowballoptions-margin','marginList':[0.9925,0.9925,0.9925],'subject':'东方证券-朴石金衍13号场外期权估值(雪球期权)'},
                   #{"idList": ['ZSCF-O20220707002'], 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'snowballoptions-JSZB','subject':'东方证券-招商财富场外期权估值(雪球期权)'},
                   #{"idList": ['DFZQ-AZSM-2022071101'], 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'snowballoptions-margin','marginList':[0.2],'subject':'东方证券-盎泽场外期权估值(雪球期权)'},
                      #{"idList": ['SXTZ-S20220623801','SXTZ-S20220706801'], 'name': '', 'targetEmail': ['zhangbing5@orientsec.com.cn','xgxg@orientsec.com.cn'], 'sendtype': 'swap','subject':'东方-思衍收益互换估值'},
                      #{"idList": ['SXTZ-S20220623801','SXTZ-S20220706801'], 'name': '', 'targetEmail': ['zhangbing5@orientsec.com.cn','xgxg@orientsec.com.cn'], 'sendtype': 'swap-detail','subject':'东方-思衍收益互换估值'},
########################################################################################################
                    # 周一发上周五  
                     #   {"idList": ['ZT20220518001','ZT20220602001','ZT20220728001'], 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'snowballoptions-margin','marginList':[0],'subject':'东方证券场外期权估值(雪球期权)'},
                      #  {"idList": ['ZXJTZG-O20220804001'], 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'snowballoptions-margin','marginList':[0.99],'subject':'东方证券-中信建投场外期权估值(雪球期权)'},
                      #  {"idList": ['O20210902701','O2021090701','PYAS-O20220607001','PYAS-O2022062001'], 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'snowballoptions','subject':'浦银安盛资管雪球估值'},
                     #   {"idList": ['ZSCF-O20211203001','ZSCF-O20220426001','ZSCF-O20220428001','ZSCF-O20220527001','ZSCF-DYLD-O20220527001','ZSCF-O20220623001','ZSCF-O20220707001','ZSCF-O20220722001','ZSCF-O20220801001'], 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'snowballoptions-JSZB','subject':'东方证券-招商财富场外期权估值(雪球期权)'},
                     #   {"idList": ['ZSCF-20210908001','ZSCF-20211020001','ZSCF-O20211203002','SWG162'], 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'otheroptions','subject':'东方证券-招商财富场外期权估值'},
                     #   {"idList": ['O20210820802'], 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'axzq','transferIdList':['2021-3359'],'pvModify':[-40000],'subject':'东方证券-长江证券场外期权估值'},
                      #  {"idList": ['BRYT-O20211224001','BRYT-O20220303001','BRYT-O20220406001','BRYT-O20220411001','BRYT-O20220524001','BRYT-O20220602001','BRYT-O20220602002','BRYT-O20220614001','BRYT-O20220705001','BRYT-O20220718001'], 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'snowballoptions-BRYT','subject':'博润银泰-东方证券场外期权估值'},
                    #    {"idList": ['DFZQ-D-202105'], 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'ztzq','transferIdList':['O20210820801'],'pvModify':[-40000],'subject':'东方证券-安信资管场外期权估值'},
                     #   {"idList": ['SWHY-O20211231801'], 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'snowballoptions-JSZB','subject':'申万资管-东方证券场外期权估值(雪球期权)'},
                      #  {"idList": ['GFZG-O20220104802'], 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'otheroptions-GFZG','subject':'广发资管-东方证券场外期权估值'},
                      #  {"idList": ['NYLC-O20220105001','NYLC-O20220616001'], 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'otheroptions','subject':'东方证券-宁银理财场外期权估值'},
                   #    {"idList": ['YCTZ-O20220608801','YCTZ-O20220621801'], 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'snowballoptions-margin','marginList':[0.9925,0.9925],'subject':'一村投资-东方证券场外期权估值(雪球期权)'},
                     #   {"idList": ['S20210823700'], 'name': '华夏金翼泰添利1号互换-中证500', 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'swap-index','subject':'东方-华夏资本场外期权估值'},
                     #  {"idList": ['ZSCF-20211104001'], 'name': '招商财富新利35号互换-中证500', 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'swap-index','subject':'东方-招商财富场外期权估值'},
                    #   {"idList": ['SPX582'], 'name': '金鳍682期', 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'swap-index','subject':'东方-重庆信托场外期权估值'},
                    #  {"idList": ['GFZG-S20220104801'], 'name': '广发资管沪玺1号', 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'gf-swap','subject':'广发资管沪玺1号-东方证券收益互换估值'},
                   #   {"idList": ['YHJH-S20220602001'], 'name': '银河宏汇增利1号互换-中证500', 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'swap-index','subject':'东方-银河宏汇增利1号收益互换估值'},
                   {"idList": ['SHZQ-O20220804801'], 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'snowballoptions-SHZQ','subject':'东方-上海证券场外期权估值（雪球期权）','marginList':[0],'text':'注：该估值系根据双方共同协商确定的方法所作估值，仅供参考，不作为双方损益计算和结算依据。双方损益计算和结算以双方共同签署的交易确认书约定为准。'},
########################################################################################################
                    # 周五发周四
                       #{"idList": ['JSZB-O20211027001','JSZB-O20211116001','JSZB-O20211117001','JSZB-O20211118001','JSZB-O20211118002','JSZB-O20211207001','JSZB-O20211214001','JSZB-O20211217001','JSZB-O20211217002','JSZB-O20211217003','JSZB-O20211220001','JSZB-O20211221001','JSZB-O20211222001','JSZB-O20211227001','JSZB-O20211227002','JSZB-O20211229001','JSZB-O20220113001','JSZB-O20220118001','JSZB-O20220628001'], 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'snowballoptions-JSZB','subject':'东方证券-嘉实资本场外期权估值(雪球期权)'},
                       # {"idList": ['JSZB-O20211117002'], 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'otheroptions-JSZB','subject':'东方证券-嘉实资本场外期权估值'},
                    #{"idList": ['JSZB-S20220705001', 'JSZB-S20220715001'], 'name': '嘉实资本-中证500', 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'swap-index','subject':'东方-嘉实资本场外期权估值'},
########################################################################################################
                    # 月初发上月末
                    #  {"idList": ['ZT20220518001','ZT20220602001','ZT20220728001'], 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'snowballoptions-margin','marginList':[0,0,0],'subject':'东方证券场外期权估值(雪球期权)'},
                   #  {"idList": ['BRYT-O20211224001','BRYT-O20220303001','BRYT-O20220406001','BRYT-O20220411001','BRYT-O20220524001','BRYT-O20220602001','BRYT-O20220602002','BRYT-O20220614001','BRYT-O20220705001','BRYT-O20220718001'], 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'snowballoptions-BRYT','subject':'博润银泰-东方证券场外期权估值'},
                  #  {"idList": ['SXZQ-20211029001','SXZQ-20211028001','SXZQ-20211020001','SXZQ-20210928001','SXZQ-20210916001','O20210903701','SXZQ-20211103001','SXZQ-20211105001','SXZQ-O20220121001','SXZQ-O20220107001','SXZQ-O20220527001','SXZQ-O20220505001','SXZQ-O20220624001'], 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'otheroptions','subject':'东方证券-山西证券场外期权估值'},
                 #  {"idList": ['ZSCF-O20211203001','ZSCF-O20220426001','ZSCF-O20220428001','ZSCF-O20220527001','ZSCF-DYLD-O20220527001','ZSCF-O20220623001','ZSCF-O20220707001','ZSCF-O20220707002','ZSCF-O20220722001','ZSCF-O20220801001'], 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'snowballoptions-JSZB','subject':'东方证券-招商财富场外期权估值(雪球期权)'},
                 #  {"idList": ['ZSCF-20210908001','ZSCF-20211020001','ZSCF-O20211203002','SWG162'], 'targetEmail': ['hanxun@orientsec.com.cn','xgxg@orientsec.com.cn'], 'sendtype': 'otheroptions','subject':'东方证券-招商财富场外期权估值'},
                   #   {"idList": ['JYZB-20211019001','JYZB-S20220125001'], 'name': '江苏锦盈互换-中证500', 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'swap-index','subject':'江苏锦盈互换-中证500收益互换估值'},
                   #  {"idList": ['ZXJTZG-O20220804001'], 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'snowballoptions-margin','marginList':[0.99],'subject':'东方证券-中信建投场外期权估值(雪球期权)'},
                  #   {"idList": ['ZSCF-20211104001'], 'name': '招商财富新利35号互换-中证500', 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'swap-index','subject':'东方-招商财富场外期权估值'},
                 #   {"idList": ['JSZB-S20220705001', 'JSZB-S20220715001'], 'name': '嘉实资本-中证500', 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'swap-index','subject':'东方-嘉实资本场外期权估值'},
                 #{"idList": ['SHZQ-O20220804801'], 'targetEmail': ['xgxg@orientsec.com.cn'], 'sendtype': 'snowballoptions-SHZQ','subject':'东方-上海证券场外期权估值（雪球期权）','marginList':[0],'text':'注：该估值系根据双方共同协商确定的方法所作估值，仅供参考，不作为双方损益计算和结算依据。双方损益计算和结算以双方共同签署的交易确认书约定为准。'},
                        ]
########################################################################################################
    acceptDictList_Agents = [
########################################################################################################
                    # 每天发送
                  #       {"idList": ['HQCZ-O20220223001','HQCZ-O20220223002','HQCZ-O20220301001'], 'targetEmail': ['xgxg@orientsec.com.cn','hanxun@orientsec.com.cn','cptz@tvpfund.com', 'yywb@cmschina.com.cn'], 'sendtype': 'snowballoptions-margin','marginList':[0.2,0.2,0.2],'subject':'横琴淳臻投资管理中心（有限合伙）代淳臻灵活配置3期私募证券投资基金场外期权估值'},                 
                  #       {"idList": ['ABM-O20220315001'], 'targetEmail': ['xgxg@orientsec.com.cn','fuyuting@orientsec.com.cn','waibaoshuju@csc.com.cn','tgguzhi@csc.com.cn','abama03@abmzcgl.com','otct@abmzcgl.com'], 'sendtype': 'snowballoptions-margin','marginList':[0.2],'subject':'珠海阿巴马代创新驱动3号场外期权估值(雪球期权)'},
                  #       {"idList": ['YSTZ-O20220422001'], 'targetEmail': ['xgxg@orientsec.com.cn', 'hanxun@orientsec.com.cn', 'yywb@cmschina.com.cn', 'chanpin@yingshuitouzi.com', 'gz@yingshuitouzi.com'], 'sendtype': 'snowballoptions-margin','marginList':[1],'subject':'迎水绿洲12号场外期权估值(雪球期权)'},   
                  #      {"idList": ['SNTZ-O20220525001','SNTZ-O20220615001','SNTZ-O20220615002'], 'targetEmail': ['xgxg@orientsec.com.cn', 'hanxun@orientsec.com.cn','tggzz@htsc.com','wbgzz@htsc.com','chenyongqing@simu100.cn','xian.tang@hotmail.com','qiuqinwei123@aliyun.com'], 'sendtype': 'snowballoptions-SNHY','subject':'东方证券-寿宁海韵26号场外期权估值(雪球期权)'},
                  #      {"idList": ['YSTZ-O20220617004','YSTZ-O20220617001','YSTZ-O20220617002','YSTZ-O20220617003','YSTZ-O20220728001'], 'targetEmail': ['xgxg@orientsec.com.cn','hanxun@orientsec.com.cn','chanpin@yingshuitouzi.com','gz@yingshuitouzi.com','cwjz@tg.gtja.com','cwysp@tg.gtja.com'], 'sendtype': 'snowballoptions-margin','marginList':[1,1,1,1,1],'subject':'东方证券-迎水投资聚宝20号场外期权估值(雪球期权)'},
                  #     {"idList": ['FZZQ-O20220623001'], 'targetEmail': ['xgxg@orientsec.com.cn','hanxun@orientsec.com.cn','zgfata@foundersc.com','liujinyuan@foundersc.com','chenghui@foundersc.com','fzzgjg_xueqiu@foundersc.com','wanglin5@foundersc.com','wangshanshan5@foundersc.com','chenyinglu@foundersc.com','keyaohong@foundersc.com','zangxiaohan@foundersc.com','liujx_zy@bj.icbc.com.cn'], 'sendtype':'otheroptions','subject':'东方证券-方正证券艾华5号场外期权估值'},
                  #    {"idList": ['JXTZ-O20220628801'], 'targetEmail': ['xgxg@orientsec.com.cn', 'songhuawei@orientsec.com.cn','szjxysp@163.com'], 'sendtype': 'snowballoptions-margin','marginList':[0.2],'subject':'东方证券-深圳金犀基金场外期权估值(雪球期权)'},
                  #    {"idList": ['YHDR-O20220704801'], 'targetEmail': ['xgxg@orientsec.com.cn','songhuawei@orientsec.com.cn','otc_derivatives@galaxyderivatives.com'], 'sendtype': 'snowballoptions-margin','marginList':[0.2],'subject':'东方证券-银河德睿场外期权估值(雪球期权)'},
                  #   {"idList": ['PSTZ-O20220705801', 'PSTZ-O20220712801', 'PSTZ-O20220719801'], 'targetEmail': ['xgxg@orientsec.com.cn', 'songhuawei@orientsec.com.cn','yywb@cmschina.com.cn','shuo.chen@postone.com.cn','xiao.wang@postone.com.cn'], 'sendtype': 'snowballoptions-margin','marginList':[0.9925,0.9925,0.9925],'subject':'东方证券-朴石金衍13号场外期权估值(雪球期权)'},
                  #{"idList": ['ZSCF-O20220707002'], 'targetEmail': ['xgxg@orientsec.com.cn', 'hanxun@orientsec.com.cn', 'FA_Non-stndMangGrp@cmfchina.com','FAzgskj@cmfchina.com','CMFQSJS@cmfchina.com','jint@cmwachina.com','jingsh@cmwachina.com','chenyt@cmwachina.com','zhouzy@cmwachina.com'], 'sendtype': 'snowballoptions-JSZB','subject':'东方证券-招商财富场外期权估值(雪球期权)'},
                  #{"idList": ['DFZQ-AZSM-2022071101'], 'targetEmail': [ 'wukexiang@orientsec.com.cn','xgxg@orientsec.com.cn','cwysp@tg.gtja.com'], 'sendtype': 'snowballoptions-margin','marginList':[0.2],'subject':'东方证券-盎泽场外期权估值(雪球期权)'},
                   #{"idList": ['SXTZ-S20220623801','SXTZ-S20220706801'], 'name': '', 'targetEmail': ['xgxg@orientsec.com.cn','songhuawei@orientsec.com.cn','sxcpjz@sixiecapital.com','yywb@cmschina.com.cn','ta@sixiecapital.com','dfjjwb@orientsec.com.cn','dftg@orientsec.com.cn','yanjiayun@orientsec.com.cn','zhangbing5@orientsec.com.cn'], 'sendtype': 'swap','subject':'东方-思衍收益互换估值'},
                   #{"idList": ['SXTZ-S20220623801','SXTZ-S20220706801'], 'name': '', 'targetEmail': ['xgxg@orientsec.com.cn','songhuawei@orientsec.com.cn','sxcpjz@sixiecapital.com','yywb@cmschina.com.cn','ta@sixiecapital.com','dfjjwb@orientsec.com.cn','dftg@orientsec.com.cn','yanjiayun@orientsec.com.cn','zhangbing5@orientsec.com.cn'], 'sendtype': 'swap-detail','subject':'东方-思衍收益互换估值'},
########################################################################################################
                    # 周一发上周五
                   #   {"idList": ['ZT20220518001','ZT20220602001','ZT20220728001'], 'targetEmail': ['xgxg@orientsec.com.cn','jiaojuan@orientsec.com.cn', 'pansuoxian@orientsec.com.cn','wangxuanxuan@orientsec.com.cn','wk@orientsec.com.cn','yuwenqian@orientsec.com.cn'], 'sendtype': 'snowballoptions-0%','subject':'东方证券场外期权估值(雪球期权)'},
                    #  {"idList": ['ZXJTZG-O20220804001'], 'targetEmail': ['xgxg@orientsec.com.cn', 'hanxun@orientsec.com.cn','wangxiaolongbj@csc.com.cn',' xiuziyun@csc.com.cn','chenruibo@csc.com.cn', 'xuexiangqiu@csc.com.cn',' csc_zgb_derivative@163.com','zhangchenguang@csc.com.cn','zhangxuewei1@cmbc.com.cn'], 'sendtype': 'snowballoptions-margin','marginList':[0.99],'subject':'东方证券-中信建投场外期权估值(雪球期权)'},
                    #  {"idList": ['O20210902701', 'O2021090701','PYAS-O20220607001','PYAS-O2022062001'], 'targetEmail': ['xgxg@orientsec.com.cn', 'hanxun@orientsec.com.cn','fanzl@py-axa.com', 'liulm@py-axa.com', 'wangzb@py-axa.com', 'zhangli@py-axa.com', 'jiangxiaofang@py-axa.com', 'tghsgz12@spdb.com.cn'], 'sendtype': 'snowballoptions','subject':'浦银安盛资管雪球估值'},
                    #   {"idList": ['ZSCF-O20211203001','ZSCF-O20220426001','ZSCF-O20220428001','ZSCF-O20220527001','ZSCF-DYLD-O20220527001','ZSCF-O20220623001','ZSCF-O20220707001','ZSCF-O20220722001','ZSCF-O20220801001'], 'targetEmail': ['xgxg@orientsec.com.cn', 'hanxun@orientsec.com.cn', 'FA_Non-stndMangGrp@cmfchina.com','FAzgskj@cmfchina.com','CMFQSJS@cmfchina.com','jint@cmwachina.com','jingsh@cmwachina.com','chenyt@cmwachina.com','zhouzy@cmwachina.com'], 'sendtype': 'snowballoptions-JSZB','subject':'东方证券-招商财富场外期权估值(雪球期权)'},
                   #   {"idList": ['ZSCF-20210908001','ZSCF-20211020001','ZSCF-O20211203002','SWG162'], 'targetEmail': ['xgxg@orientsec.com.cn','hanxun@orientsec.com.cn', 'FA_Non-stndMangGrp@cmfchina.com'], 'sendtype': 'otheroptions','subject':'东方证券-招商财富场外期权估值'},
                    #   {"idList": ['O20210820802'], 'targetEmail': ['xgxg@orientsec.com.cn','songhuawei@orientsec.com.cn','leizhuo@cjsc.com','917561569@qq.com','wilsonweiwang@outlook.com', 'liudy2@cjsc.com', 'zhangzs@cjsc.com', 'wangwei34@cjsc.com.cn'], 'sendtype': 'axzq','transferIdList':['2021-3359'],'pvModify':[-40000],'subject':'东方证券-长江证券场外期权估值'},
                    #   {"idList": ['BRYT-O20211224001','BRYT-O20220303001','BRYT-O20220406001','BRYT-O20220411001','BRYT-O20220524001','BRYT-O20220602001','BRYT-O20220602002','BRYT-O20220614001','BRYT-O20220705001','BRYT-O20220718001'], 'targetEmail': ['xgxg@orientsec.com.cn', 'hanxun@orientsec.com.cn','fuyuting@orientsec.com.cn','fadata@citics.com', 'CUSTODIANDATA@CITICS.COM', 'tang.tang@brytasset.com', 'lei.shi@brytasset.com', 'qiang.peng@brytasset.com', 'pifvaluation@citics.com', 'fadata@citics.com'], 'sendtype': 'snowballoptions-BRYT','subject':'博润银泰-东方证券场外期权估值'},
                   #   {"idList": ['DFZQ-D-202105'], 'targetEmail': ['xgxg@orientsec.com.cn','hanxun@orientsec.com.cn','tanbg@essence.com.cn','axgzz@essence.com.cn', 'zengyuanmu@bankcomm.com', 'hubo511@pingan.com.cn'], 'sendtype': 'ztzq','transferIdList':['O20210820801'],'pvModify':[-40000],'subject':'东方证券-安信资管场外期权估值'},
                    #  {"idList": ['SWHY-O20211231801'], 'targetEmail': ['xgxg@orientsec.com.cn', 'songhuawei@orientsec.com.cn','tgzxdz@swhysc.com','huangyi1@swhysc.com','liuwenbo@swhysc.com','qiuxiaoping@swhysc.com','sunsheng@swhysc.com'], 'sendtype': 'snowballoptions-JSZB','subject':'申万资管-东方证券场外期权估值(雪球期权)'},
                     #  {"idList": ['GFZG-O20220104802'], 'targetEmail': ['xgxg@orientsec.com.cn', 'songhuawei@orientsec.com.cn','gzwanghuan@gf.com.cn','gfzgcw@gf.com.cn','dong_zt@bankcomm.com','zhangxiaowen@bankcomm.com','zhuqiangqiang@gf.com.cn','gfzgsjzx@gf.com.cn','zcgllltzb@gf.com.cn','fuannan@gf.com.cn'],'sendtype': 'otheroptions-GFZG','subject':'广发资管-东方证券场外期权估值'},
                   #    {"idList": ['NYLC-O20220105001','NYLC-O20220616001'], 'targetEmail': ['xgxg@orientsec.com.cn','hanxun@orientsec.com.cn','dongzhoubin@wmbnb.com', 'huweichao@wmbnb.com', 'renguanyu@wmbnb.com'], 'sendtype': 'otheroptions','subject':'东方证券-宁银理财场外期权估值'},
                  #     {"idList": ['YCTZ-O20220608801','YCTZ-O20220621801'], 'targetEmail': ['xgxg@orientsec.com.cn', 'songhuawei@orientsec.com.cn','yywb@cmschina.com.cn','ycyy@v-invest.cn'], 'sendtype': 'snowballoptions-99.25%','subject':'一村投资-东方证券场外期权估值(雪球期权)'},
                 #     {"idList": ['S20210823700'], 'name': '华夏金翼泰添利1号互换-中证500', 'targetEmail': ['xgxg@orientsec.com.cn','hanxun@orientsec.com.cn','wb_fa@chinaamc.com','zhengyi_justice@cmbchina.com','wyb@cmbchina.com',' gzzctgyw@cmbchina.com'], 'sendtype': 'swap-index','subject':'东方-华夏资本收益互换估值'},
                 #     {"idList": ['ZSCF-20211104001'], 'name': '招商财富新利35号互换-中证500', 'targetEmail': ['xgxg@orientsec.com.cn','hanxun@orientsec.com.cn','FA_Non-stndMangGrp@cmfchina.com'], 'sendtype': 'swap-index','subject':'东方-招商财富收益互换估值'},
                 #      {"idList": ['SPX582'], 'name': '金鳍682期', 'targetEmail': ['xgxg@orientsec.com.cn','songhuawei@orientsec.com.cn','shiboran@cqiti.com','chuhongjiang@cqiti.com'], 'sendtype': 'swap-index','subject':'东方-重庆信托收益互换估值'},
                  #     {"idList": ['GFZG-S20220104801'], 'name': '广发资管沪玺1号', 'targetEmail': ['xgxg@orientsec.com.cn','songhuawei@orientsec.com.cn','gzwanghuan@gf.com.cn','gfzgcw@gf.com.cn','dong_zt@bankcomm.com','zhangxiaowen@bankcomm.com','zhuqiangqiang@gf.com.cn','gfzgsjzx@gf.com.cn','zcgllltzb@gf.com.cn','fuannan@gf.com.cn'], 'sendtype': 'gf-swap','subject':'广发资管沪玺1号-东方证券收益互换估值'},
                 #    {"idList": ['YHJH-S20220602001'], 'name': '银河宏汇增利1号互换-中证500', 'targetEmail': ['xgxg@orientsec.com.cn','hanxun@orientsec.com.cn','yhzq_wbzggz@chinastock.com.cn','mayun_yhjh@chinastock.com.cn', 'sunmengyu_cp@chinastock.com.cn', 'weihongrui_yhjh@chinastock.com.cn', 'xiqiushen_yhjh@chinastock.com.cn', 'baichenxi@cmbchina.com', 'zouyanchen_yhjh@chinastock.com.cn'], 'sendtype': 'swap-index','subject':'东方-银河宏汇增利1号收益互换估值'},
########################################################################################################
                       # 周五发周四
                      # {"idList": ['JSZB-O20211027001','JSZB-O20211116001','JSZB-O20211117001','JSZB-O20211118001','JSZB-O20211118002','JSZB-O20211207001','JSZB-O20211214001','JSZB-O20211217001','JSZB-O20211217002','JSZB-O20211217003','JSZB-O20211220001','JSZB-O20211221001','JSZB-O20211222001','JSZB-O20211227001','JSZB-O20211227002','JSZB-O20211229001','JSZB-O20220113001','JSZB-O20220118001','JSZB-O20220628001'],'targetEmail': ['xgxg@orientsec.com.cn','hanxun@orientsec.com.cn', 'fuyuting@orientsec.com.cn','hfm-llgzz@jsfund.cn', 'lizj01@harvestcm.com', 'opsnav@jsfund.cn', 'OPSPV@jsfund.cn','wujy01@harvestcm.com'], 'sendtype': 'snowballoptions-JSZB','subject':'东方证券-嘉实资本场外期权估值(雪球期权)'},
                     #{"idList": ['JSZB-O20211117002'], 'targetEmail': ['xgxg@orientsec.com.cn','hanxun@orientsec.com.cn', 'fuyuting@orientsec.com.cn','hfm-llgzz@jsfund.cn', 'lizj01@harvestcm.com', 'opsnav@jsfund.cn', 'OPSPV@jsfund.cn'], 'sendtype': 'otheroptions-JSZB','subject':'东方证券-嘉实资本场外期权估值'},
                     # {"idList": ['JSZB-S20220705001', 'JSZB-S20220715001'], 'name': '嘉实资本-中证500', 'targetEmail': ['xgxg@orientsec.com.cn','fuyuting@orientsec.com.cn','opsnav@jsfund.cn','OPSPV@jsfund.cn','hfm-llgzz@jsfund.cn','lizj01@harvestcm.com','wujy01@harvestcm.com'], 'sendtype': 'swap-index','subject':'东方-嘉实资本场外期权估值'},
########################################################################################################
                   # 月初发上月末
                   #  {"idList": ['ZT20220518001','ZT20220602001','ZT20220728001'], 'targetEmail': ['xgxg@orientsec.com.cn', 'jiaojuan@orientsec.com.cn', 'pansuoxian@orientsec.com.cn','wangxuanxuan@orientsec.com.cn','wk@orientsec.com.cn','yuwenqian@orientsec.com.cn'], 'sendtype': 'snowballoptions-0%','subject':'东方证券场外期权估值(雪球期权)'},
                  #  {"idList": ['ZXJTZG-O20220804001'], 'targetEmail': ['xgxg@orientsec.com.cn', 'hanxun@orientsec.com.cn','wangxiaolongbj@csc.com.cn',' xiuziyun@csc.com.cn','chenruibo@csc.com.cn', 'xuexiangqiu@csc.com.cn',' csc_zgb_derivative@163.com','zhangchenguang@csc.com.cn','zhangxuewei1@cmbc.com.cn'], 'sendtype': 'snowballoptions-margin','marginList':[0.99],'subject':'东方证券-中信建投场外期权估值(雪球期权)'},
                   #  {"idList": ['BRYT-O20211224001','BRYT-O20220303001','BRYT-O20220406001','BRYT-O20220411001','BRYT-O20220524001','BRYT-O20220602001','BRYT-O20220602002','BRYT-O20220614001','BRYT-O20220705001','BRYT-O20220718001'], 'targetEmail': ['xgxg@orientsec.com.cn', 'hanxun@orientsec.com.cn', 'fuyuting@orientsec.com.cn','fadata@citics.com', 'CUSTODIANDATA@CITICS.COM', 'tang.tang@brytasset.com', 'lei.shi@brytasset.com', 'qiang.peng@brytasset.com', 'pifvaluation@citics.com', 'fadata@citics.com'], 'sendtype': 'snowballoptions-BRYT','subject':'博润银泰-东方证券场外期权估值'},
                   #   {"idList": ['SXZQ-20211029001','SXZQ-20211028001','SXZQ-20211020001','SXZQ-20210928001','SXZQ-20210916001','O20210903701','SXZQ-20211103001','SXZQ-20211105001','SXZQ-O20220121001','SXZQ-O20220107001','SXZQ-O20220527001','SXZQ-O20220505001','SXZQ-O20220624001'], 'targetEmail': ['xgxg@orientsec.com.cn','hanxun@orientsec.com.cn','otcd_trading@sxzq.com'], 'sendtype': 'otheroptions','subject':'东方证券-山西证券场外期权估值'},
                #   {"idList": ['ZSCF-O20211203001','ZSCF-O20220426001','ZSCF-O20220428001','ZSCF-O20220527001','ZSCF-DYLD-O20220527001','ZSCF-O20220623001','ZSCF-O20220707001','ZSCF-O20220707002','ZSCF-O20220722001','ZSCF-O20220801001'], 'targetEmail': ['xgxg@orientsec.com.cn', 'hanxun@orientsec.com.cn', 'FA_Non-stndMangGrp@cmfchina.com','FAzgskj@cmfchina.com','CMFQSJS@cmfchina.com','jint@cmwachina.com','jingsh@cmwachina.com','chenyt@cmwachina.com','zhouzy@cmwachina.com'], 'sendtype': 'snowballoptions-JSZB','subject':'东方证券-招商财富场外期权估值(雪球期权)'},
                  #  {"idList": ['ZSCF-20210908001','ZSCF-20211020001','ZSCF-O20211203002','SWG162'], 'targetEmail': ['xgxg@orientsec.com.cn', 'hanxun@orientsec.com.cn', 'FA_Non-stndMangGrp@cmfchina.com'], 'sendtype': 'otheroptions','subject':'东方证券-招商财富场外期权估值'},
               #  {"idList": ['JYZB-20211019001','JYZB-S20220125001'], 'name': '江苏锦盈互换-中证500', 'targetEmail': ['xgxg@orientsec.com.cn','hanxun@orientsec.com.cn','jsjyz999@126.com'], 'sendtype': 'swap-index','subject':'江苏锦盈互换-中证500收益互换估值'},
               #  {"idList": ['ZSCF-20211104001'], 'name': '招商财富新利35号互换-中证500', 'targetEmail': ['xgxg@orientsec.com.cn','hanxun@orientsec.com.cn','FA_Non-stndMangGrp@cmfchina.com'], 'sendtype': 'swap-index','subject':'东方-招商财富收益互换估值'},
             # {"idList": ['JSZB-S20220705001', 'JSZB-S20220715001'], 'name': '嘉实资本-中证500', 'targetEmail': ['xgxg@orientsec.com.cn','fuyuting@orientsec.com.cn','opsnav@jsfund.cn','OPSPV@jsfund.cn','hfm-llgzz@jsfund.cn','lizj01@harvestcm.com','wujy01@harvestcm.com'], 'sendtype': 'swap-index','subject':'东方-嘉实资本场外期权估值'},
                      ]
    #下一行False为给自己发送.True为发送给客户
    acceptDictList = ToAddress(acceptDictList_Agents, acceptDictList_Self, config = False)
    myDictList = []
    for date in dateList:
        for acceptDict in acceptDictList:
            try:
                data=GetData(date, acceptDict)
                data['date']=date
                myDictList.append(data)
            except:
                id = acceptDict['idList']
                data={'idList':id}
                data['date']=date
                data['result']=pd.DataFrame()
                myDictList.append(data)

    for myDict in myDictList:
        sendMail(myDict)




